<template>
	<view class="content pc-tou-gao " >
		<view class="scroll-fix" >

		
			<view class="d-kuan-juzhong ">
				<!--头部-->
				<view class="d-kuan pc-dingbu ">
					<DToubu 
					@login-success="handleLoginSuccess" 
					:dengluxianshi="denglu_xianshi"
					@update-dengluxianshi="handleUpdateDengluxianshi"
					></DToubu>
				</view>


				<!--头部-->
				<!--下面内容-->
				<view class="d-kuan d-buhuanhang">
					<!--左边导航-->
					<view class="d-daohang d-you-10 pc-yincang" id="zuo-daohang" :style="{height: leftNavHeight}">
						<view class="d-daohang-5 scrollable-content daohanggaodu" >
							
						    
							<view class="d-kuan d-buhuanhang d-gao-50 d-hanggao-50">
								<uv-icon @click="fanhui_ce" color="#05b3ad" size="28" name="arrow-left" class="d-zuo-10"></uv-icon>
								<view class="d-kuan d-chaochu-1 d-zuo-10 d-jiacu">
									【 {{jianjie.title}} 】手册
								</view>
								
							</view>
							<!--view class="d-kuan  d-xia-10">
								<view class="d-kuan d-chaochu-1 d-zuo-10 d-chaochu-2">
									{{jianjie.description}}
								</view>
							</view-->
							<view v-for="(list,index) in list_data" :key="index" class="d-kuan">
							    <view :class="[yijiid === list.id ? 'd-beijing-bai d-yuanjiao-10' : 'd-kuan d-beijing-gaibian d-yuanjiao-10']">
									
									<view class="d-kuan d-buhuanhang d-gao-50 d-hanggao-50">
										<uv-icon color="#05b3ad" size="28" name="list" class="d-zuo-10"></uv-icon>
										<view class="d-kuan d-chaochu-1 d-zuo-10 d-jiacu">
											{{list.name}}
										</view>
										
									</view>
									<view v-for="(list11,index11) in list.list" :key="index11" class="d-kuan" @click="neirong_url(list11.id,list.id)">
										<view class="d-kuan d-buhuanhang d-gao-30 d-hanggao-30">
											<uv-icon size="28" color="#ffffff" name="minus" class="d-zuo-10"></uv-icon>
											<view class="d-kuan d-chaochu-1 d-zuo-10 " :style="{ color: ceid == list11.id ? '#2dbfba' : '#000000' }">
												{{list11.title}}
											</view>
										</view>
									</view>
									<view  v-for="(list2,index2) in list.erji" :key="index2" class="d-kuan">
										<view class="d-kuan d-buhuanhang d-gao-50 d-hanggao-50">
											<uv-icon color="#bcbcbc" size="28" name="grid" class="d-zuo-10"></uv-icon>
											<view class="d-kuan d-chaochu-1 d-zuo-10">
												{{list2.name}}
											</view>
										</view>
										<view v-for="(list22,index22) in list2.list" :key="index22" class="d-kuan" @click="neirong_url(list22.id,list.id)">
											<view class="d-kuan d-buhuanhang d-gao-30 d-hanggao-30">
												<uv-icon size="28" color="#ffffff" name="minus" class="d-zuo-10"></uv-icon>
												<view class="d-kuan d-chaochu-1 d-zuo-10 " :style="{ color: ceid == list22.id ? '#2dbfba' : '#000000' }">
													{{list22.title}}
												</view>
											</view>
										</view>
										
									</view>

								    
								</view>
							</view>
							<view class="d-kuan" style="height: 100px;"></view>
						</view>

					</view>
					<!--左边导航-->
					<!--右边内容-->
					<view class="d-kuan pc-zuo-520">
						
						<view class="pc-neikuang-20-list-pc ">
							<view class="d-kuan">
								<!--返回-->
								<view class="d-guding-1" >
									<uv-navbar leftText="返回" :fixed="false" title="内容详情" rightIcon="list" :safeAreaInsetTop="false" customStyle="border-radius: 20rpx;" bgColor="#f3f3f3">
										<template v-slot:left >
											<view class="uv-nav-slot" >
												<uv-icon name="arrow-left" size="19"  @click="fanhui"></uv-icon>
												<uv-line direction="column" :hairline="false" length="16" margin="0 8px" class="d-you-10"></uv-line>
												<uv-icon class="" name="home" size="19" @click="fanhui_ce"></uv-icon>
											</view>
										</template>
										<template v-slot:right>
											<view class="uv-nav-slot2" @click="daohang">
												<uv-icon name="list" size="19" ></uv-icon>
												
											</view>
										</template>
									</uv-navbar>
								</view>
							</view>
							<view class="d-beijing-bai d-bianhua-10 d-yuanjiao-10">
								<view class="uv-content">
									<uv-parse :content="neirong" selectable="true" copy-link="true"></uv-parse>
								</view>
							</view>

						
							
						</view>
						<view class="d-clear"></view>

					</view>
					<!--右边内容-->

				</view>
				<!--下面内容-->


			</view>

			<view class="d-clear"></view>
		
		</view>
		<uv-popup ref="popup" zIndex="99999">
			<view class="popup-body" :style="{width: '500rpx',height: leftNavHeight_h5}">
				<view v-for="(list,index) in list_data" :key="index" class="d-kuan">
					<view :class="[yijiid === list.id ? 'd-beijing-bai d-yuanjiao-10' : 'd-kuan d-beijing-gaibian d-yuanjiao-10']">
						
						<view class="d-kuan d-buhuanhang d-gao-50 d-hanggao-50">
							<uv-icon color="#05b3ad" size="28" name="list" class="d-zuo-10"></uv-icon>
							<view class="d-kuan d-chaochu-1 d-zuo-10 d-jiacu">
								{{list.name}}
							</view>
							
						</view>
						<view v-for="(list11,index11) in list.list" :key="index11" class="d-kuan" @click="neirong_url(list11.id,list.id)">
							<view class="d-kuan d-buhuanhang d-gao-30 d-hanggao-30">
								<uv-icon size="28" color="#ffffff" name="minus" class="d-zuo-10"></uv-icon>
								<view class="d-kuan d-chaochu-1 d-zuo-10 " :style="{ color: ceid == list11.id ? '#2dbfba' : '#000000' }">
									{{list11.title}}
								</view>
							</view>
						</view>
						<view  v-for="(list2,index2) in list.erji" :key="index2" class="d-kuan">
							<view class="d-kuan d-buhuanhang d-gao-50 d-hanggao-50">
								<uv-icon color="#bcbcbc" size="28" name="grid" class="d-zuo-10"></uv-icon>
								<view class="d-kuan d-chaochu-1 d-zuo-10">
									{{list2.name}}
								</view>
							</view>
							<view v-for="(list22,index22) in list2.list" :key="index22" class="d-kuan" @click="neirong_url(list22.id,list.id)">
								<view class="d-kuan d-buhuanhang d-gao-30 d-hanggao-30">
									<uv-icon size="28" color="#ffffff" name="minus" class="d-zuo-10"></uv-icon>
									<view class="d-kuan d-chaochu-1 d-zuo-10 " :style="{ color: ceid == list22.id ? '#2dbfba' : '#000000' }">
										{{list22.title}}
									</view>
								</view>
							</view>
							
						</view>
						
					</view>
				</view>	
			</view>
		</uv-popup>
		<!--底部-->
		<view class="d-kuan d-waigao-20 d-bianhua-10 pc-yincang"></view>

		<view class="d-clear pc-yincang"></view>
		<view class="d-weibu pc-yincang">
			<Dweibu></Dweibu>
		</view>

	</view>
</template>

<script>
    import Api from '@/utils/api.js';
	import ShouceApi from '@/utils/shouce_api.js';
	import { getRequest,postRequest } from '@/utils/wxRequest.js';
    //引入组件 d-toubu
    import DToubu from '@/components/d-toubu/d-toubu.vue'
	import Ddaohang from '@/components/d-daohang/d-daohang.vue'
	import Dweibu from '@/components/d-weibu/d-weibu.vue'
	import shouce_api from '../../utils/shouce_api';
	
	
	
	export default {
		data() {
			return {
				id:'',
				ceid:'',
				yijiid:'',
				title: 'Hello',
				leftNavHeight: '500rpx', // 默认高度
				leftNavHeight_h5: '100vh', // 默认高度
                rightColWidth: '300px', // 默认宽度
				rightColLeft: '0px', // 添加这个属性

				
				erjidata:[],
				erjiindex:'',//当前激活的二级菜单索引
				activeIndex: -1, // 当前激活的一级菜单索引
				zhishi_tuijian_data:[], // 知识推荐数据
				zhishi_daohang_list:[], // 知识导航列表
				zhishi_list:[], // 知识列表
				haibao_data:[], // 海报数据
				imageSize: {
        		    width: 0,
        		    height: 0
        		},
				tubiaolist: 
				['integral', 'kefuv-ermai', 'coupon', 'gift', 'scan',
					'pause-circle', 'volume-off', 'email', 'list'
				],
				denglu_xianshi:0, // 登录显示

				tiezi_list:[], // 帖子列表

				currentPage: 1, //下拉加载
    			pageSize: 12, //下拉加载
    			isLoading: false, //下拉加载
    			noMoreData: false, //下拉加载
				urls: [
					'https://cdn.uviewui.com/uview/album/1.jpg',
					'https://cdn.uviewui.com/uview/album/2.jpg',
					'https://cdn.uviewui.com/uview/album/3.jpg',
					'https://cdn.uviewui.com/uview/album/4.jpg',
					'https://cdn.uviewui.com/uview/album/7.jpg',
					'https://cdn.uviewui.com/uview/album/6.jpg',
					'https://cdn.uviewui.com/uview/album/5.jpg'
				],
				kuan_shu: 12, //格大小
				swiperHeight: '250',
				gao: '20', //图片高度
				tubiao_data: [
					{
						name: 'photo',
						title: '李白'
					}, {
						name: 'lock',
						title: '韩信'
					}, {
						name: 'star',
						title: '刘备'
					}, {
						name: 'star',
						title: '元芳'
					},
					{
						name: 'photo',
						title: '李白'
					}, {
						name: 'lock',
						title: '韩信'
					}, {
						name: 'star',
						title: '刘备'
					}, {
						name: 'star',
						title: '元芳'
					}

				],
				list_data:[],//手册列表
				jianjie:[],
				neirong:'',



			}
		},
		components: {
  		    DToubu,
			Ddaohang,
			Dweibu
  		},
		mounted() {
			// 添加滚动事件监听
			const element = document.querySelector('.daohanggaodu');
			if (element) {
				// 读取存储的滚动数据
				const scrollData = uni.getStorageSync('scrollData');
				//console.log('读取到的滚动数据:', scrollData);
				

				if (scrollData && scrollData.scrollTop !== undefined) {
					console.log('准备设置滚动高度:', scrollData.scrollTop);
					// 增加延迟时间确保元素完全渲染
					setTimeout(() => {
						if (element) {
							element.scrollTop = scrollData.scrollTop;
							console.log('滚动高度已设置:', element.scrollTop);
							

							// 双重确认，立即检查并再次设置
							if (element.scrollTop !== scrollData.scrollTop) {
								console.log('滚动高度设置不一致，重新设置');
								element.scrollTop = scrollData.scrollTop;
							}
						} else {
							console.error('元素不存在，无法设置滚动高度');
						}
					}, 300); // 增加延迟时间至300ms
				} else {
					//console.log('没有有效的滚动数据');
				}
				

				this.scrollHandler = () => this.calculateScrollData();
				element.addEventListener('scroll', this.scrollHandler);
			} else {
				console.error('未找到id为daohanggaodu的元素');
			}
			//var m = this.$store.state;
			//console.log('mmmm',m);
			
    	    this.setLeftNavHeight();
			this.getRightColWidth(); // 添加这行
    	    // 添加窗口大小变化监听
    	    window.addEventListener('resize', this.setLeftNavHeight);
			window.addEventListener('resize', this.getRightColWidth); // 添加窗口大小变化监听
			var e = this;
			//this.onImageLoad(e);
    	},
    	beforeDestroy() {
			// 移除滚动事件监听与窗口监听（仅 H5 有 document/window）
			const element = document.querySelector('.daohanggaodu');
			if (element && this.scrollHandler) {
				element.removeEventListener('scroll', this.scrollHandler);
			}
    	    // 移除监听
    	    window.removeEventListener('resize', this.setLeftNavHeight);
			window.removeEventListener('resize', this.getRightColWidth); // 添加这行
    	},
		onShow() {
			//var m = this.$store.state;
			//console.log('12300000:', this.$store.state.memberuid);
			/*this.zhishi_daohang_api();*/
			var e = this;
			/*this.zhishi_list_api(e);
			this.haibao_api();
			this.zhishituijian_api();
			this.getTiezi_api(e,false);*/
			this.getShouce_xiangqing_api();
			
		},
		onLoad(e) {
			this.id = e.id || '';
			this.ceid = e.ce || '';
			this.yijiid = e.yijiid || '';
			if(e.ce){
				this.getNeirong_api(e.ce);
			}
		},
		computed: {
		  yidenglu() {
		    return (this.$store.state.memberuid && this.$store.state.keycode) ? 1 : 0;
		  },
		  touxiang() {
		    return this.$store.state.member? this.$store.state.member.avatar : '';
		  },
		  name1() {
		    return this.$store.state.member? this.$store.state.member.name : '';
		  }
		},
		onReachBottom() {
  			this.onReachBottom(); //下拉加载分页
  		},

		methods: {
			//图片
			onImageLoad(e, index) {
				// 获取系统信息
				const systemInfo = uni.getSystemInfoSync();
        	    // 计算可用高度（可根据实际需求调整计算方式）
        	    const windowHeight = systemInfo.windowWidth;
				if(windowHeight >=920){
					var gao = 30;
				} else {
					var gao = 0;
				}
				this.$nextTick(() => {
        		    const query = uni.createSelectorQuery().in(this);
        		    query.select('#tupian-'+index).boundingClientRect(data => {
        		        if (data && data.width > 0 && data.height > 0) {
        		            this.$set(this.haibao_data[index], 'imageSize', {
        		                width: data.width,
        		                height: data.height + gao
        		            });
							console.log('图片尺寸:', this.haibao_data[index].imageSize);
        		        } else {
        		            console.warn(`图片${index}尺寸获取失败`);
        		            this.$set(this.haibao_data[index], 'imageSize', {
        		                width: 300,
        		                height: 200
        		            });
        		        }
        		    }).exec();
        		});

    		},
			getRightColWidth() {
				// 获取系统信息
				const systemInfo = uni.getSystemInfoSync();
        	    // 计算可用高度（可根据实际需求调整计算方式）
        	    const windowWidth = systemInfo.windowWidth;
				var d = this;

                this.$nextTick(() => {
				if(windowWidth >=920){
					d.gao = 20;
					d.kuan_shu = 12;
					d.swiperHeight = '250';
				} else {
					d.gao = 10;
					d.kuan_shu = 12;
					d.swiperHeight = '120';

				}
				//console.log('窗口高度:', windowWidth);

                 const query = uni.createSelectorQuery().in(this);
                 query.select('#youbiankuan').boundingClientRect(rect => {
                   if (rect) {
                     /*this.rightColWidth = `${rect.width+20}px`;
                     console.log('右侧列宽度:', this.rightColWidth);*/
					 	this.rightColWidth = `${rect.width-80}px`;
                    	this.rightColLeft = `${rect.left}px`; // 计算左侧位置
                    	console.log('右侧列位置:', this.rightColWidth);
                   }
                 }).exec();
               });
            },

			//首页
			shouye(){
				uni.navigateTo({
					url: '/pages/index/index',
					fail: (err) => {
						console.error('跳转失败:', err)
					}
				})
			},
			yiji(index) {
    		  // 切换激活的一级菜单
    		  this.activeIndex = index;
    		  // 根据激活的一级菜单显示对应的二级菜单
			  if(index == 0){
				  this.erjidata = [];
			  }else{
				  this.erjidata = this.zhishi_daohang_list[index].son;
			  }
			  const data = {
				  categories:index
			  }
			  this.zhishi_list_api(data);
    		  //this.erjidata = this.zhishi_daohang_list[index].son;
			  console.log(this.erjidata);
    		},
			erji(index) {
    		  // 切换激活的二级菜单
    		  this.erjiindex = index;

			  const data = {
				  categories:index
			  }
			  this.zhishi_list_api(data);
			  //console.log(index);

    		},
			toggleErji(index) {
    		  if (this.activeIndex === index) {
    		    // 点击已激活的菜单，收起二级菜单
    		    this.activeIndex = -1;
    		    this.currentErji = [];
    		  } else {
    		    // 点击新的菜单，显示对应的二级菜单
    		    this.activeIndex = index;
    		    this.currentErji = this.zhishi_daohang_list[index].erji;
    		  }
    		},
			setLeftNavHeight() {
        	    // 获取系统信息
        	    const systemInfo = uni.getSystemInfoSync();
        	    // 计算可用高度（可根据实际需求调整计算方式）
        	    const windowHeight = systemInfo.windowHeight;
        	    const headerHeight = 70; // 头部高度估计值
        	    const calculatedHeight = windowHeight - headerHeight;
				
        	    // 设置左边导航高度
        	    this.leftNavHeight = `${calculatedHeight}px`;
				this.leftNavHeight_h5 = `${windowHeight}px`;
        	},
			zhishi(id){
				console.log(id);
				try {
  				  uni.navigateTo({
  				    url: '/pages/zhishi/index?id='+id,
  				    fail: (err) => {
  				      console.error('跳转失败:', err)
  				    }
  				  })
  				} catch (e) {
  				  console.error('跳转异常:', e)
  				}
			},
			
			handleLoginSuccess() {
  			  this.$forceUpdate();
  			},
			// 知识导航接口
			zhishi_daohang_api(){
				var get_data = getRequest(Api.getZhishi_daohang());
				var res;
				get_data.then(duixin_data => {
					res = duixin_data;
					if(res.data.code) {
						// 转换时间戳为日期格式
						//var list = res.data ? res.data.data : {};
						var list = res.data && res.data.data ? res.data.data : [];
						// 在 list 前面添加插入一个新的数据“首页”
						/*list.unshift({
            			    id: '0',
							pid: '0',
            			    name: '首页',
            			    icon: 'home',
            			    son: [] // 首页没有二级菜单
            			});*/
        				this.zhishi_daohang_list = list;
						console.log(list);
					} else {
						uni.showToast({
							icon: 'none',
							title: '获取失败，请稍后重试'
						});
					}
				})
			},
			zhishi_list_api(data){
				if (!data) data = {};
				if (!data) data = {};
		  		if (!data.page) data.page = 1;
		  		if (!data.categories) data.categories = 0;
		  		if (!data.search) data.search = '';
				var get_data = getRequest(Api.getZhishi_list(data));
				var res;	
				get_data.then(duixin_data => {
					res = duixin_data;	
					if(res.data.code) {
						// 转换时间戳为日期格式
						var list = res.data? res.data.data : {};
						this.zhishi_list = list;	
					} else {
						uni.showToast({
							icon: 'none',
							title: '获取失败，请稍后重试'
						});
					}
				})
			},
			// 海报接口
			haibao_api(){
				// 获取系统信息
				const systemInfo = uni.getSystemInfoSync();
        	    // 计算可用高度（可根据实际需求调整计算方式）
        	    const windowHeight = systemInfo.windowHeight;
				if(windowHeight >=920){
					var gao = 200;
					
				} else {
					var gao = 120;

				}

				var get_data = getRequest(Api.getHaibao());
				var res;
				get_data.then(duixin_data => {
					res = duixin_data;
					if(res.data.code) {
						// 转换时间戳为日期格式
						//var list = res.data ? res.data.data : {};
						/*var list = res.data && res.data.data ? res.data.data : [];
        				this.haibao_data = list;*/
						this.haibao_data = (res.data.data || []).map(item => ({
            			    ...item,
            			    imageSize: { width: 300, height: gao } // 添加默认尺寸
            			}));
						
					} else {
						uni.showToast({
							icon: 'none',
							title: '获取失败，请稍后重试'
						});
					}
				})
			},
			// 知识推荐 getZhishi_tuijian
			zhishituijian_api(){
				var get_data = getRequest(Api.getZhishi_tuijian());
				var res;
				get_data.then(duixin_data => {
					res = duixin_data;
					if(res.data.code) {
						// 转换时间戳为日期格式
						//var list = res.data ? res.data.data : {};
						/*var list = res.data && res.data.data ? res.data.data : [];
        				this.haibao_data = list;*/
						this.zhishi_tuijian_data = res.data.data;
						
					} else {
						uni.showToast({
							icon: 'none',
							title: '获取失败，请稍后重试'
						});
					}
				})


			},
			denglu_fabu(){
				if(this.yidenglu == 0){
					this.denglu_xianshi = 1;
				} else {
					this.denglu_xianshi = 0;	
				}
				
				console.log('发布登录',this.denglu_xianshi);
				
			},
			// 更新判断是否登录
			handleUpdateDengluxianshi(value) {
			  this.denglu_xianshi = value;
			  console.log('关闭登录',this.denglu_xianshi);
			},
			// 帖子列表
			getTiezi_api(data,isLoadMore = false){
				if (!data) data = {};
				if (!data) data = {};
				if (!data.page) data.page = 1;
				if (!data.categories) data.categories = 0;
				if (!data.search) data.search = '';
				
				var get_data = getRequest(Api.getTiezi_list(data));
				var res;
				get_data.then(duixin_data => {
					res = duixin_data;
					if(res.data.code) {
						// 转换时间戳为日期格式
						var list = res.data? res.data.data : {};
						if (isLoadMore) {
        				  // 加载更多时追加数据
        				  this.tiezi_list = [...this.tiezi_list, ...list];
        				} else {
        				  // 非加载更多时替换数据
        				  this.tiezi_list = list;
        				}	
						this.noMoreData = list.length < this.pageSize;

					} else {
						uni.showToast({
							icon: 'none',
							title: '获取失败，请稍后重试'
						});
					}
					this.isLoading = false;
				}).catch(() => {
    			  this.isLoading = false;
    			  if (isLoadMore) {
    			    this.currentPage--; // 加载失败时回退页码
    			  }
    			});


			},
			// 下拉加载更多
			onReachBottom() {
  			  if (this.isLoading || this.noMoreData) return;
  			  this.isLoading = true;
  			  this.currentPage++;
			  // 获取当前激活的分类ID
    			const currentCategoryId = this.activeIndex.id >= 0 ? this.activeIndex.id : 0;
    			

  			  const data = {
  			    page: this.currentPage,
  			    categories: currentCategoryId
  			  };
			  console.log('分页',this.activeIndex.id);
  			  this.getTiezi_api(data, true); // 添加第二个参数表示是加载更多
  			},
			// 帖子
			tiezi(cid,id){
				console.log(id);	
				try {
  				  uni.navigateTo({
  				    url: '/pages/tiezi/index?id='+id+'&cid='+cid,
  				    fail: (err) => {
  				      console.error('跳转失败:', err)
  				    }
  				  })
  				} catch (e) {
  				  console.error('跳转异常:', e)
  				}

			},
			// 手册详情列表
			getShouce_xiangqing_api(){
				// getShouce_xiangqing
				
				const data = {
					id:this.id,
				};
				
				var get_data = getRequest(ShouceApi.getShouce_xiangqing(),data);
				var res;
				get_data.then(duixin_data => {
					res = duixin_data;
					if(res.data.code) {
						// 转换时间戳为日期格式
						var list = res.data? res.data.data.lisi : [];
						var jianjie = res.data? res.data.data.jianjie : [];
						this.list_data = list;
						this.jianjie = jianjie;
						if(!this.ceid){
							this.neirong = jianjie['content'];
						}
						
					} else {
						uni.showToast({
							icon: 'none',
							title: '获取失败，请稍后重试'
						});
					}
					
				}).catch(() => {
					uni.showToast({
						icon: 'none',
						title: '获取失败，请稍后重试'
					});
				});
			},
			// 返回
			fanhui() {
				
			   // 获取页面栈
			     const pages = getCurrentPages();
			     // 如果页面栈长度小于等于1，说明没有上一级页面
			     if (pages.length <= 1) {
			        console.log('没有上一级页面');
			        uni.reLaunch({
			          url: '/pages/index/index'
			        });
			     } else {
			        // 有上一级页面则返回
			        uni.navigateBack({
			          delta: 1
			        });
			    }
			},
			//返回手册主页
			fanhui_ce(){
				uni.navigateTo({
			        url: '/pages/shouce/index'
			    });
			},
			
			// 导航列表
			daohang(){
				// 实现导航列表功能
				this.$refs.popup.open('right');
				//console.log('打开导航列表');
			},

			neirong_url(id,yijiid){
    // 关闭右侧弹窗，避免导航后残留的滚动锁定
    if (this.$refs.popup && this.$refs.popup.close) {
        this.$refs.popup.close();
    }
    // 获取当前页面的URL参数
    this.ceid = id;
    const pages = getCurrentPages();
    const currentPage = pages[pages.length - 1];
    const options = currentPage.options;

    // 构建新的URL参数，保留原id并添加ce参数
    const query = `id=${options.id || ''}&ce=${id}&yijiid=${yijiid}`;

    // 等待弹窗完全关闭后再导航，避免 H5 上 body 被锁导致新页面初始不能滚动
    setTimeout(() => {
        uni.navigateTo({
            url: `/pages/shouce/shouce?${query}`
        });
    }, 50);
},

// 计算滚动数据
			calculateScrollData() {
				// 固定id="daohanggaodu"的滚动高度
				const element = document.querySelector('.daohanggaodu');
				if (element) {
					const scrollTop = element.scrollTop;
					const scrollHeight = element.scrollHeight;
					const clientHeight = element.clientHeight;
					const scrollPercentage = (scrollTop / (scrollHeight - clientHeight)) * 100;
					 
					/*console.log('滚动数据:', {
						scrollTop: scrollTop, // 已滚动距离
						scrollHeight: scrollHeight, // 内容总高度
						clientHeight: clientHeight, // 可见高度
						scrollPercentage: scrollPercentage // 滚动百分比
					});*/
					//存储 滚动数据
					uni.setStorageSync('scrollData', {
						scrollTop: scrollTop,
						scrollHeight: scrollHeight,
						clientHeight: clientHeight,
						scrollPercentage: scrollPercentage
					});
					
					 
					// 可以在这里添加滚动数据的使用逻辑
				}
			},
			
			getNeirong_api(id){
				const data = {
					id:id,
				};
				
				var get_data = getRequest(ShouceApi.getShouce_neirong(),data);
				var res;
				get_data.then(duixin_data => {
					res = duixin_data;
					if(res.data.code) {
						// 转换时间戳为日期格式
						this.neirong = res.data.data && res.data.data.neirong && res.data.data.neirong.neirong;
					} else {
						uni.showToast({
							icon: 'none',
							title: '获取失败，请稍后重试'
						});
					}
					
				}).catch(() => {
					uni.showToast({
						icon: 'none',
						title: '获取失败，请稍后重试'
					});
				});
			},



		}
	}
</script>

<style scoped lang="scss">

	.content {
		
		
		display: flex;
		flex-direction: column;
		/*align-items: center;*/
		
		background-color: #f3f3f3;
		/*padding-top: 70px;*/
		margin-bottom: 70px;
		/*height: 100vh;*//* 添加全屏 */
		/*width: 100vw;*/ /* 添加全屏*/
		box-sizing: border-box;
		

	}

	/* 修复全页无法滚动：让页面包裹容器可垂直滚动（首次访问也生效） */
	.scroll-fix {
		/* 在某些页面中被设置为 overflow-y: hidden，这里在本页覆盖为可滚动 */
		overflow-y: auto;
		/* iOS 惯性滚动 */
		-webkit-overflow-scrolling: touch;
		/* 让容器至少撑满视口高度，确保出现滚动条 */
		min-height: 100vh; // 首屏保证有滚动上下文
		box-sizing: border-box;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
	/* 屏幕宽度大于786px时隐藏uni-page-head */
    @media (min-width: 786px) {
        uni-page-head {
            display: none !important;
            opacity: 0 !important;
            height: 0 !important;
            visibility: hidden !important;
        }
    }
	/*.d-daohang{
		
		width: 600rpx;
	}*/
	/* 添加在style部分 */
	.d-daohang-zuo {
    position: fixed;
    left: 0;
    
    width: 180rpx;
    height: calc(100vh - 70rpx);
    background: #f5f5f5;
    z-index: 100;
	box-shadow: 2px 0 5px rgba(177, 177, 177, 0.1);
  }
  
  .d-daohang-you {
    position: fixed;
    left: 180rpx;
    
    width: 180rpx;
    height: calc(100vh - 70rpx);
    background: #fff;
    z-index: 100;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
  }
  .d-erji-item {
    height: 60rpx;
    line-height: 60rpx;
    padding: 0 20rpx;
   /* border-bottom: 1px solid #f0f0f0;*/
  }
  
  .d-erji-item:active {
    background: #f5f5f5;
  }
  .you-guding {
	position: fixed;
	top: 0; /* 根据头部高度调整 */
	/*box-shadow: -2px 0 5px rgba(0,0,0,0.1);*/
	transition: all 0.3s ease;
}
/* 大于786px时的样式 */
@media screen and (min-width: 1024px) {
	.d-bianhua-10 {
		padding: 30px;
	}
	.pc-zuo-520 {
		margin-left: 520rpx;
	}
	.you-guding {
		position: fixed;
			
		top: 60px; /* 根据头部高度调整 */
		/*box-shadow: -2px 0 5px rgba(0,0,0,0.1);*/
		transition: all 0.3s ease;
	}
		
	
}
.d-beijing-gaibian{
	background: #f5f5f5;
}
.d-beijing-gaibian:hover{
	background: #ffffff;
}
@mixin flex($direction: row) {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: $direction;
	}
	.uv-nav-slot {
		@include flex;
		align-items: center;
		justify-content: space-between;
		border-width: 0.5px;
		border-radius: 100px;
		border-color: #dadbde;
		padding: 3px 7px;
		opacity: 0.8;
	}
.scrollable-content {
	overflow-y: auto;
	max-height: 95vh; /* 设置最大高度以启用滚动 */
}
/* 滚动条样式 */
.scrollable-content::-webkit-scrollbar {
	width: 2px; /* 滚动条宽度 */
}
.scrollable-content::-webkit-scrollbar-track {
	background:rgb(255, 255, 255); /* 滚动条轨道背景 */
}
.scrollable-content::-webkit-scrollbar-thumb {
	background:rgb(241, 241, 241); /* 滚动条滑块颜色 */
	border-radius: 1.5px; /* 滚动条圆角 */
}
.scrollable-content::-webkit-scrollbar-thumb:hover {
	background: #555; /* 滚动条滑块悬停颜色 */
}
.uv-content {
	padding: 24rpx;
	line-height: 1.8;
}
	.popup-body {



overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
</style>
